var loaderUtils = require('loader-utils')
var Px2rem = require('px2rem-liulaoda')

module.exports = function (source) {
  var options = loaderUtils.getOptions(this)
  if(options.exclude && this.resourcePath && this.resourcePath.match(options.exclude) !== null) {
    return source
  } else {
    var px2remIns = new Px2rem(options)
    return px2remIns.generateRem(source)
  }
}
